home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / EditorCenterPanMachine.as < prev    next >
Encoding:
Text File  |  2007-09-27  |  4.3 KB  |  155 lines

  1. class EditorCenterPanMachine extends Library.State
  2. {
  3.    var oParentMachine;
  4.    var nNumber;
  5.    var mcRef;
  6.    var sState;
  7.    function EditorCenterPanMachine(__mcRef, __oParentMachine)
  8.    {
  9.       super(__mcRef);
  10.       this.oParentMachine = __oParentMachine;
  11.       Main.Instance.doAddListener(this);
  12.    }
  13.    function setNumber(__nNumber)
  14.    {
  15.       this.nNumber = __nNumber;
  16.       this.doChangeNumber();
  17.       this.doSetUpIdle();
  18.    }
  19.    function setRef(__mcRef)
  20.    {
  21.       this.mcRef = __mcRef;
  22.       this.sState = "___RESET___";
  23.       this.setState("Idle");
  24.    }
  25.    function doScrollUp()
  26.    {
  27.       this.setState("Raise");
  28.    }
  29.    function doScrollDown()
  30.    {
  31.       this.setState("Lower");
  32.    }
  33.    function doRefreshVisual()
  34.    {
  35.       this.doLoadStateAction();
  36.    }
  37.    function doDestroy()
  38.    {
  39.       Main.Instance.doRemoveListener(this);
  40.    }
  41.    function doRaise()
  42.    {
  43.       if(this.isStateComplete())
  44.       {
  45.          this.setState("Idle");
  46.       }
  47.    }
  48.    function doLower()
  49.    {
  50.       if(this.isStateComplete())
  51.       {
  52.          this.setState("Idle");
  53.       }
  54.    }
  55.    function doLoadStateAction()
  56.    {
  57.       super.doLoadStateAction();
  58.       switch(this.CurrentState)
  59.       {
  60.          case "Idle":
  61.             this.doSetUpIdle();
  62.             LevelEditor.Instance.onMoveStop();
  63.             break;
  64.          case "Raise":
  65.             this.doSetUpRaise();
  66.             break;
  67.          case "Lower":
  68.             this.doSetUpLower();
  69.       }
  70.       this.doChangeNumber();
  71.    }
  72.    function doChangeNumber()
  73.    {
  74.       var _loc7_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
  75.       var _loc2_ = LevelEditor.Instance.getNumberForPanel(_loc7_);
  76.       var _loc3_ = 0;
  77.       switch(this.CurrentState)
  78.       {
  79.          case "Idle":
  80.             _loc3_ = 0;
  81.             break;
  82.          case "Raise":
  83.             _loc3_ = -1;
  84.             break;
  85.          case "Lower":
  86.             _loc3_ = 1;
  87.       }
  88.       _loc2_ += _loc3_;
  89.       if(_loc2_ > LevelEditor.LETTERS.length - 1)
  90.       {
  91.          _loc2_ = 0;
  92.       }
  93.       else if(_loc2_ < 0)
  94.       {
  95.          _loc2_ = LevelEditor.LETTERS.length - 1;
  96.       }
  97.       var _loc5_ = _loc2_ - 1;
  98.       var _loc6_ = _loc2_;
  99.       var _loc4_ = _loc2_ + 1;
  100.       if(_loc5_ < 0)
  101.       {
  102.          _loc5_ = LevelEditor.LETTERS.length - 1;
  103.       }
  104.       if(_loc4_ > LevelEditor.LETTERS.length - 1)
  105.       {
  106.          _loc4_ = 0;
  107.       }
  108.       var _loc10_ = LevelEditor.LETTERS[_loc5_];
  109.       var _loc9_ = LevelEditor.LETTERS[_loc6_];
  110.       var _loc8_ = LevelEditor.LETTERS[_loc4_];
  111.       this.mcRef.mcState.mcBoxTop.mcNumber.txtNumber.text = _loc10_;
  112.       this.mcRef.mcState.mcBoxCenter.mcNumber.txtNumber.text = _loc9_;
  113.       this.mcRef.mcState.mcBoxBottom.mcNumber.txtNumber.text = _loc8_;
  114.    }
  115.    function doSetUpIdle()
  116.    {
  117.       var _loc2_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
  118.       this.oParentMachine.setVisualForBox(_loc2_,this.mcRef.mcState.mcBoxCenter);
  119.    }
  120.    function doSetUpLower()
  121.    {
  122.       var _loc3_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
  123.       var _loc4_ = LevelEditor.Instance.getNumberForPanel(_loc3_);
  124.       var _loc2_ = _loc4_ + 1;
  125.       if(_loc2_ > LevelEditor.LETTERS.length - 1)
  126.       {
  127.          _loc2_ = 0;
  128.       }
  129.       else if(_loc2_ < 0)
  130.       {
  131.          _loc2_ = LevelEditor.LETTERS.length - 1;
  132.       }
  133.       var _loc5_ = LevelEditor.Instance.getPanelLinkage(_loc2_) + LevelEditor.Instance.getCurrentSuffix();
  134.       this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxTop);
  135.       this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
  136.    }
  137.    function doSetUpRaise()
  138.    {
  139.       var _loc3_ = LevelEditor.Instance.getLinkageFor(this.nNumber);
  140.       var _loc4_ = LevelEditor.Instance.getNumberForPanel(_loc3_);
  141.       var _loc2_ = _loc4_ - 1;
  142.       if(_loc2_ > LevelEditor.LETTERS.length - 1)
  143.       {
  144.          _loc2_ = 0;
  145.       }
  146.       else if(_loc2_ < 0)
  147.       {
  148.          _loc2_ = LevelEditor.LETTERS.length - 1;
  149.       }
  150.       var _loc5_ = LevelEditor.Instance.getPanelLinkage(_loc2_) + LevelEditor.Instance.getCurrentSuffix();
  151.       this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxBottom);
  152.       this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
  153.    }
  154. }
  155.